/*
** socket.h for  in /u/all/tessa_b/public/zappy/network/socket
** 
** Made by arnaud1 tessa
** Login   <tessa_b@epitech.net>
** 
** Started on  Tue Jul  5 18:23:22 2011 arnaud1 tessa
** Last update Tue Jul  5 18:35:03 2011 arnaud1 tessa
*/

#ifndef		__SOCKET_H__
#define		__SOCKET_H__

#define		BUF_SIZE	1024

typedef struct	s_socket
{
  int		id;
  int		fd;
  char		send_buf[BUF_SIZE];
  char		recv_buf[BUF_SIZE];
  int		can_send;
  int		can_recv;
}		t_socket;

void		socket_init(t_socket *sock);
void		delete_socket(t_socket *sock);
int		socket_connect_to_server(t_socket *sock, char *host, short port);
int		socket_connect_from_accepted_fd(t_socket *sock, int fd);
int		socket_recv(t_socket *sock, char *msg, int blocksize);
int		socket_send(t_socket *sock, char *msg);

#endif		/*__SOCKET_H__*/
